/*
 * SysCatalog.h
 *
 *  Created on: 22-Oct-2013
 *      Author: pridhvi
 */

#ifndef SYSCATALOG_H_
#define SYSCATALOG_H_
#include "../PageLayout/Heap.h"
#include "../PageLayout/DBMetaData.h"
#include <vector>
#include <string>
using namespace std;
class SysCatalog {
private:
	Heap *sysTableHeap;
	Heap *sysTableColHeap;
	Heap *sysIndexheap;
	Heap *sysIndexColHeap;
	DBMetaData *dbMainHeader_;
public:
	SysCatalog();
	virtual ~SysCatalog();
	STATUS_CODE addInitSysTableRecord();
	STATUS_CODE addInitSysColRecord();
	STATUS_CODE addInitTableIndexRecord();
	STATUS_CODE addInitTableColIndexRecord();
	STATUS_CODE addTableEntry(Schema & schema);
	STATUS_CODE deleteTableEntry(Schema& schema);
	STATUS_CODE addIndexEntry(QueryStructures *executeStruct);
	STATUS_CODE deleteIndexEntry(QueryStructures *executeStruct);
	STATUS_CODE getAllTables(vector<string>& tableList);
	int getNextTableId();
	STATUS_CODE getTableId(const char* tableName,int& tableId);
	STATUS_CODE getSchema(const char* tableName,Schema& schema);
	STATUS_CODE getSchema(int dirHeaderpage,Schema& schema);
	int getHeaderPgNo(const char* tableName,int& headerPgNo);
	bool isIndexExist(Schema& schema,string identifier,vector<int> indexHeaderPgNoList);
};

#endif /* SYSCATALOG_H_ */
